<?php
	// If Process type is PREVIEW/EDIT/DELETE, Get All variables needed to be displayed by form, Edit SQL & Variable if necessary !!!
	if($process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE")
	{
		$sql2 = "	select a.* , b.filename
					from tbl_header a
						left join ms_file b
							on a.headerurlimage = b.fileid and b.filerole = 'image' and b.stsrc = 'A'
					where a.stsrc = 'A' and a.headerid = '".$PK_id."' and a.moduleid = '".$process_module_id."' ";
		$exe2 = mysql_query($sql2) or die(mysql_error());
		$num2 = mysql_num_rows($exe2);
		$row2 = mysql_fetch_array($exe2);
		
		// Set Value if data is found
		if($num2>0)
		{
			$val_header_PK_id = $row2['headerid'];
			$val_header_name = $row2['headername'];
			$val_header_label = $row2['headerlabel'];
			$val_header_url_image = $row2['filename'];
			$val_header_url_href = $row2['headerurlhref'];
			$val_header_description = $row2['headerdescription'];
			$val_header_position = $row2['headerposition'];
			$val_header_activate = $row2['headerstatus'];
		}
		else
		{
			$val_header_PK_id = "";
			$val_header_name = "";
			$val_header_label = "";
			$val_header_url_image = "";
			$val_header_url_href = "";
			$val_header_description = "";
			$val_header_position = "";
			$val_header_activate = "";
		}
	}
	else
	{
		$val_header_PK_id = "";
		$val_header_name = "";
		$val_header_label = "";
		$val_header_url_image = "";
		$val_header_url_href = "";
		$val_header_description = "";
		$val_header_position = "";
		$val_header_activate = "";
	}
?>
<!-- Start Row Data -->
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Name</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_header_name" value="<?php echo $val_header_name; ?>" />
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_header_name" value="<?php echo $val_header_name; ?>" style="width:300px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Label</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_header_label" value="<?php echo $val_header_label; ?>" style="width:300px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Image</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<?php
			$sql3 = "	select a.fileid, a.filelabel, a.filename, b.imagewidth, b.imageheight
						from ms_file a
							left join ms_image b
								on a.fileid = b.fileid
						where a.filerole = 'image' and a.stsrc = 'A' order by a.filelabel asc ";
			$exe3 = mysql_query($sql3) or die(mysql_error());
			$num3 = mysql_num_rows($exe3);
			
			if($num3 > 0)
			{
		?>
		<select <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> name="txt_header_url_image">
			<?php if($process_type == "ADD"){ ?><option value="-1" >Select Image !</option><?php } ?>
			<?php
				while($row3 = mysql_fetch_array($exe3))
				{
			?>
			<option <?php if($row3['filename'] == $val_header_url_image){echo "selected=selected";} ?> value="<?php echo $row3['fileid']; ?>" ><?php echo ucwords(strtolower($row3['filelabel'])); if($row3['imagewidth'] && $row3['imageheight']){ echo " - ".$row3['imagewidth']."x".$row3['imageheight'];} ?></option>
			
			<?php
				}
			?>
		</select>
		<?php
			}
			else
			{
		?>
			<span style="color:#FF0000;">No Data !</span>
		<?php
			}
		?>
	</div>
	<div style="clear:both;"></div>
</div>
<?php if($process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE"){ ?>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Preview</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:right;">
		<img src="<?php if($val_header_url_image != "" || $val_header_url_image != null){echo getURLdomain()."/upload/".file_string($val_header_url_image);} ?>" width="500px" />
	</div>
	<div style="clear:both;"></div>
</div>
<?php } ?>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">HREF URL</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_header_url_href" value="<?php echo $val_header_url_href; ?>" style="width:500px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Description</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_header_description" value="<?php echo $val_header_description; ?>" style="width:400px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Position</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="number" required min="1" max="100" name="txt_header_position" value="<?php echo $val_header_position; ?>" style="width:50px; height:18px; font-size:10px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Activate</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" name="txt_header_PK_id" value="<?php echo $val_header_PK_id; ?>" style="width:200px; height:18px;" />
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_header_activate" value="1" <?php if(isset($val_header_activate)){if($val_header_activate == 1){echo "checked='true'";}} ?> /> Yes
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_header_activate" value="0" <?php if(isset($val_header_activate)){if($val_header_activate == 0){echo "checked='true'";}} ?> /> No
	</div>
	<div style="clear:both;"></div>
</div>
<!-- End Row Data -->